package com.ruoyi.mentor.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.mentor.service.UploadService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author LH
 * @Description
 * @Date Create in 19:27 2021/5/23
 */
@RestController
@RequestMapping("/upload")
public class UploadController {

    @Autowired
    UploadService uploadService;

    @ApiOperation("文件上传")
    @PostMapping()
    public AjaxResult upload(MultipartFile file){
        String url = uploadService.upload(file);
        return AjaxResult.success(url);
    }


}
